<%@ Page Language="C#" MasterPageFile="~/Views/Shared/Site.Master" AutoEventWireup="true" CodeBehind="IndexCollect.aspx.cs" Inherits="MusicSite.Views.Content.Collection.IndexCollect" Title="Untitled Page" %>
<%@ Register assembly="System.Web.Entity, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" namespace="System.Web.UI.WebControls" tagprefix="asp" %>
<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
<script type="text/javascript">
    function initRating(obj)
    {
        var curRating = obj.parentNode.childNodes[0].value;
        if (curRating == "")
        {
            obj.className = "star-rating";
            return;
        }
        if (curRating == "1")
        {
            obj.className = "star-rating one-star-rating";
            return;
        }
        if (curRating == "2")
        {
            obj.className = "star-rating two-star-rating";
            return;
        }
        if (curRating == "3")
        {
            obj.className = "star-rating three-star-rating";
            return;
        }
        if (curRating == "4")
        {
            obj.className = "star-rating four-star-rating";
            return;
        }
        if (curRating == "5")
        {
            obj.className = "star-rating five-star-rating";
            return;
        }
    }
</script>
    <form id="form1" runat="server">  

    <asp:Repeater ID="RepeaterAlbum" runat="server" >
    <ItemTemplate>
    <div>
        <fieldset>
            <legend><%# HttpUtility.HtmlEncode((string) DataBinder.Eval(Container.DataItem, "ArtistName"))%></legend>
            <table>
                <tr>
                    <td style="width: 120px; vertical-align:top">
                        <asp:Image ID="image" runat="server" Style="width:100px" ImageUrl='<%# "~/Content/images/" + DataBinder.Eval(Container.DataItem, "Cover") %>' />
                    </td>
                    <td style="width:150px; vertical-align:top">
                        <%# HttpUtility.HtmlEncode((string) DataBinder.Eval(Container.DataItem, "AlbumName")) %>
                    </td>
                    <td style="vertical-align:top">
                    <table style="width:300px" >
                        <asp:Repeater ID="TracksRepeater" runat="server">
                        <ItemTemplate>
                            
                            <tr>
                                <td><%# DataBinder.Eval(Container.DataItem, "TrackID") %></td>
                                
                                <td style="width:120px"><asp:HiddenField ID="rate1" runat="server" Value='<%# Bind("Rating")%>'/>
                                    <ul class="star-rating" onload="initRating(this)">
                                        <li><a href="#" title="Rate this 1 star out of 5">1</a></li>
                                        <li><a href="#" title="Rate this 2 stars out of 5">2</a></li>
                                        <li><a href="#" title="Rate this 3 stars out of 5">3</a></li>
                                        <li><a href="#" title="Rate this 4 stars out of 5">4</a></li>
                                        <li><a href="#" title="Rate this 5 stars out of 5">5</a></li>
                                    </ul>
                                </td>  
                                <td><%# HttpUtility.HtmlEncode(DataBinder.Eval(Container.DataItem, "TrackName").ToString()) %></td>  
                            </tr>
                            
                        </ItemTemplate>
                        </asp:Repeater>
                    </table>
                    </td>
                </tr>
            </table>
        </fieldset>
     </div>
    </ItemTemplate>
    </asp:Repeater>    
    </form>
<script type="text/javascript">
var lists = document.getElementsByTagName('UL');
for(var i in lists)
{
initRating(lists[i]);
}
</script>
</asp:Content>
